package com.donaghymo.liteflow.editor.storage.utils;

/**
 * 分页参数
 *
 * @author ThinkPad
 */
public class PageUtil implements java.io.Serializable {
    private static final long serialVersionUID = -1166690661944159461L;
    /**
     * 最小分页开始数
     */
    public static final int MIN_PAGE_NUM = 1;
    /**
     * 每页显示的数据条数最小值
     */
    public static final int MIN_PAGE_SIZE = 0;
    /**
     * 每页显示的数据默认值
     */
    public static final int DEFAULT_PAGE_SIZE = 20;
    /**
     * 每页显示的数据条数最大值
     */
    public static final int MAX_PAGE_SIZE = 100;

    private int pageNo = MIN_PAGE_NUM;
    private int pageSize = DEFAULT_PAGE_SIZE;

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        if (pageNo < MIN_PAGE_NUM) {
            pageNo = MIN_PAGE_NUM;
        }

        this.pageNo = pageNo;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        if (pageSize <= MIN_PAGE_SIZE) {
            pageSize = DEFAULT_PAGE_SIZE;
        }

        this.pageSize = pageSize;
    }
}
